<%- content_for :head do -%>
  <script type="text/javascript" charset="utf-8">
	zonetopaForm = new Subform('<%= escape_javascript(render(:partial => "zonetopa", :object => Zonetopa.new, :locals => {:index => "INDEX"})) %>',<%= @parcelle.zonetopas.length %>,'zonetopas');
  </script>
<%- end -%>

<p>
  <%= link_to_function "Show/Hide Params", visual_effect(:toggle_blind, :params, :duration => "0.1") %>
</p>
<div id="params" style="display:none;">
  <%= debug params %>
</div>

<%= render :partial => "error_messages", :object => @parcelle, :locals => {:order => [:name, :labtoparcelles, :all]} %>

<% form_for @parcelle do |f| -%>

<fieldset>
  <legend>Parcelle</legend>
	<table>
	<tr>
		<td>Nom : </td>
		<td><%= f.text_field :name, :size => 10 %></td>
	</tr>
	<tr>
		<td>Surface : </td>
		<td><%= f.text_field :surface, :size => 10 %> Ha</td>
	</tr>
	<tr>
		<td>Type de culture: </td>
		<td><%= select("parcelle", "typeculture_id", Typeculture.find(:all).collect{ |c| [ c.name, c.id] }) %></td>
	</tr>
	</table>
</fieldset>

<fieldset>		
  <legend>Zones</legend>		
  <div class="yui-g">		
    <div class="yui-u first">		
      <div id="zonetopas">		
        <%= render :partial => 'zonetopa', :collection => @parcelle.zonetopas %>		
      </div>		
      <p><%= link_to_function "Ajouter une Zone", "zonetopaForm.add()" %></p>		
    </div>		
  </div>		
</fieldset>

<p>
<%= f.submit "Submit" %>
</p>
<% end -%>
